//
//  ButtonGroup.h
//  TaduFramework
//
//  Created by Xu Deheng on 12-6-18.
//  Copyright (c) 2012年 Nicholas.Xu. All rights reserved.
//

#import <Foundation/Foundation.h>

#if TARGET_OS_IPHONE

#define kButtons_GroupLogging    0

@interface ButtonsGroup : NSObject
{
    NSMutableArray *_buttons;
    BOOL _multiSelection;
    NSUInteger _lastSelectedIndex;
    NSUInteger _selectedIndex;
    UIButton *_pressedButton;
    UIButton *_lastButton;
}


@property (nonatomic, readonly) NSMutableArray *buttons;
@property (nonatomic) BOOL multiSelection;
@property (nonatomic) NSUInteger lastSelectedIndex;
@property (nonatomic) NSUInteger selectedIndex;
@property (nonatomic, readonly) UIButton *pressedButton;
@property (nonatomic, readonly) UIButton *lastButton;
@property (nonatomic, assign) UIView *groupPanel;

- (BOOL)addGroupButton:(UIButton *)object;
- (BOOL)removeGroupButton:(UIButton *)object;
- (BOOL)removeAllButtons;
- (void)pressButtonAtIndex:(NSUInteger)index;
- (void)pressButton:(UIButton*)pressedButton;
- (void)reorderZPosition;
- (NSUInteger)indexOfButton:(UIButton*)button;
- (UIButton*)buttonAtIndex:(NSUInteger)index;

@end



#define kGroupButtonLogging 0

@interface GroupButton : UIButton

@property (nonatomic, retain) UIImage *pressedImage;
@property (nonatomic, retain) UIImage *unpressedImage;
@property (nonatomic, retain) UIColor *pressedTitleColor;
@property (nonatomic, retain) UIColor *unpressedTitleColor;
@property (nonatomic, getter = isPressed) BOOL pressed;
@property (nonatomic) NSUInteger zPositionOfView;

- (void)loadDefaultData;
- (void)switchToPressedView;
- (void)switchToUnpressedView;
- (void)updateZPositionOfView;

@end

#endif
